package Base64Utils;

import org.springframework.util.Base64Utils;

import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;

/**
 * @program: pangu
 * @description:
 * @author: fengjd
 * @create: 2022-06-23 09:47
 **/
public class Base64UtilsTest {

    public static void main(String[] args) {

        String abc = "abc";
        String encode = new String(Base64Utils.encode(abc.getBytes(StandardCharsets.UTF_8)));
        System.out.println("encode = " + encode);

        try {
            String decode = new String(Base64Utils.decode(encode.getBytes(StandardCharsets.UTF_8)), "utf-8");
            System.out.println("decode = " + decode);

        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

    }
}
